import sys

from PyQt5.QtCore import Qt
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
from PyQt5.QtWidgets import QApplication, QCalendarWidget, QWidget, QGraphicsDropShadowEffect


class CalendarWidget(QCalendarWidget):
    def __init__(self, *args, **kwargs):
        super(CalendarWidget, self).__init__(*args, **kwargs)
        # 隐藏左边的序号
        self.setVerticalHeaderFormat(self.NoVerticalHeader)

        # 修改周六周日颜色
        fmtGreen = QTextCharFormat()
        fmtGreen.setForeground(QBrush(Qt.green))
        self.setWeekdayTextFormat(Qt.Saturday, fmtGreen)

        fmtOrange = QTextCharFormat()
        fmtOrange.setForeground(QBrush(QColor(252, 140, 28)))
        self.setWeekdayTextFormat(Qt.Sunday, fmtOrange)
        self.setMinimumSize(280, 200)
        sd = QGraphicsDropShadowEffect()
        sd.setColor(Qt.gray)
        sd.setBlurRadius(8)
        self.setGraphicsEffect(sd)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyleSheet(StyleSheet)
    a = QWidget()
    a.setStyleSheet("background-color:red")
    w = CalendarWidget(a)
    a.show()

    sys.exit(app.exec_())
